<?php
class tags_relationModel extends baseModel{
    protected $table = 'tags_relation';

    //获取TAG关联内容
    public function relation_list($aid) {
        return $this->select('aid='.$aid);
    }

    //删除内容TAG关联
    public function content_del($aid) {
        return $this->delete('aid='.$aid);
    }

    //通过TAG删除TAG关联
    public function relation_del($tid) {
        return $this->delete('tid='.$tid);
    }

    //添加内容关联
    public function add($data) {
        return $this->insert($data);
    }

    //获取关联信息
    public function info($condition) {
        return $this->find($condition);
    }

    //通过内容ID查找关联ID
    public function relation_aid($aid){
        $condition['aid']=$aid;
        return $this->select($condition);
    }

    //通过TID查找关联
    public function relation_tid($tid){
        return $this->select('tid in('.$tid.')');
    }
	
}